Skip to content

Conversation

@surbhidhiman
Copy link

Hello Oceananigans community, I am fairly new here and I am interested in building my simulations and contribution skills with the Oceananigans package. I have opened a discussion post here and an issue here, with idea of implementing a basic lock-exchange problem. My goal is to use this case to deepen my understanding of computational fluid dynamics, boundary conditions, and density-driven mixing. My ideal outcome is to produce a fully documented example script that meets the standards of the existing examples.

I have opened this PR with a very basic version which includes my current understanding of how to run the simulations. I will happily welcome any and all feedback for any changes or ideas that would help me build on this existing script to make it a worthwhile contribution. So far, I have pulled from the internal tide example as well as the lock release validation case, and I will continue to build on what I have so far.

Thank you in advance for your time and help!

@valeriabarra valeriabarra requested a review from glwagner December 2, 2025 00:06
Comment on lines 13 to 23
# Allow for mutable surface height
z_disc = MutableVerticalDiscretization((-50, 0))

# Initialize the grid
underlying_grid = RectilinearGrid(
size = (Nx, Nz),
x = (0, L),
z = z_disc,
topology = (Bounded, Flat, Bounded),
halo = (5, 5)
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Allow for mutable surface height
z_disc = MutableVerticalDiscretization((-50, 0))
# Initialize the grid
underlying_grid = RectilinearGrid(
size = (Nx, Nz),
x = (0, L),
z = z_disc,
topology = (Bounded, Flat, Bounded),
halo = (5, 5)
)
# Allow for mutable surface height
z = MutableVerticalDiscretization((-50, 0))
x = (0, L)
# Initialize the grid
underlying_grid = RectilinearGrid(size = (Nx, Nz); halo = (5, 5), x, z, topology = (Bounded, Flat, Bounded))

@@ -0,0 +1,63 @@
using Oceananigans
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a description of what this example hopes to achieve, similar to the other examples?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added some more descriptive documentation here and I plan to add some more as well.

using Oceananigans.Units
using Oceananigans.Grids: MutableVerticalDiscretization


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, I am getting an error when I remove these lines and don't import some methods explicitly. May I ask if you have seen that before?

simulation = Simulation(model; Δt, stop_time)

# Run simulation
run!(simulation) No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example should conclude with a visualization of the results, including some analysis / physical interpretation of what the results show

buoyancy = BuoyancyTracer(),
momentum_advection = WENO(order=5),
tracer_advection = WENO(order=7),
closure = (VerticalScalarDiffusivity(ν=1e-4), HorizontalScalarDiffusivity(ν=1.0)),
Copy link
Member

@glwagner glwagner Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
closure = (VerticalScalarDiffusivity(ν=1e-4), HorizontalScalarDiffusivity(ν=1.0)),

I suggest running this as an ILES unless that doesn't work for some reason!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I have removed the closure.

# Runge Kutta good for integrating multiple processes

model = HydrostaticFreeSurfaceModel(; grid,
tracers = (:b,),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tracers = (:b,),
tracers = :b,

Comment on lines +60 to +61
simulation = Simulation(model; Δt, stop_time)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a progress function and output, similar to other examples?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a progress function and output visualization which I have attached in another comment below.

@surbhidhiman
Copy link
Author

surbhidhiman commented Dec 3, 2025

@glwagner Thank you very much for your helpful feedback. I've been working on adding some more documentation as well as visualization for the outputs of the simulation. I have attached the animation that is produced here. I plan to continue to add some helpful documentation to explain some of the numerical methods or physics behind the remaining code that is not as commented, and I will commit that as soon as I can. Of the code that is now added, I pulled strongly from some of the existing examples, but please let me know if there is anything else that you would like to see or to change.

Looking at this result of the simulation, can I ask if the parameters make sense for this use case or if there is too much noise? Also, I only ran simulation for 1 day initially to make sure that I am getting an output, but would you recommend a different runtime?
Thank you again for all your help and consideration!

lock_exchange.mp4

@surbhidhiman surbhidhiman requested a review from glwagner December 3, 2025 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants